# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput do
  @moduledoc """
  Represents the result of a single hyperparameter tuning trial from a training job. The TrainingOutput object that is returned on successful completion of a training job with hyperparameter tuning includes a list of HyperparameterOutput objects, one for each successful trial.

  ## Attributes

  *   `allMetrics` (*type:* `list(GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput_HyperparameterMetric.t)`, *default:* `nil`) - All recorded object metrics for this trial. This field is not currently populated.
  *   `builtInAlgorithmOutput` (*type:* `GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_BuiltInAlgorithmOutput.t`, *default:* `nil`) - Details related to built-in algorithms jobs. Only set for trials of built-in algorithms jobs that have succeeded.
  *   `endTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. End time for the trial.
  *   `finalMetric` (*type:* `GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput_HyperparameterMetric.t`, *default:* `nil`) - The final objective metric seen for this trial.
  *   `hyperparameters` (*type:* `map()`, *default:* `nil`) - The hyperparameters given to this trial.
  *   `isTrialStoppedEarly` (*type:* `boolean()`, *default:* `nil`) - True if the trial is stopped early.
  *   `startTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Start time for the trial.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The detailed state of the trial.
  *   `trialId` (*type:* `String.t`, *default:* `nil`) - The trial id for these results.
  *   `webAccessUris` (*type:* `map()`, *default:* `nil`) - URIs for accessing [interactive shells](https://cloud.google.com/ai-platform/training/docs/monitor-debug-interactive-shell) (one URI for each training node). Only available if this trial is part of a hyperparameter tuning job and the job's training_input.enable_web_access is `true`. The keys are names of each node in the training job; for example, `master-replica-0` for the master node, `worker-replica-0` for the first worker, and `ps-replica-0` for the first parameter server. The values are the URIs for each node's interactive shell.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allMetrics =>
            list(
              GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput_HyperparameterMetric.t()
            )
            | nil,
          :builtInAlgorithmOutput =>
            GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_BuiltInAlgorithmOutput.t() | nil,
          :endTime => DateTime.t() | nil,
          :finalMetric =>
            GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput_HyperparameterMetric.t()
            | nil,
          :hyperparameters => map() | nil,
          :isTrialStoppedEarly => boolean() | nil,
          :startTime => DateTime.t() | nil,
          :state => String.t() | nil,
          :trialId => String.t() | nil,
          :webAccessUris => map() | nil
        }

  field(:allMetrics,
    as:
      GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput_HyperparameterMetric,
    type: :list
  )

  field(:builtInAlgorithmOutput,
    as: GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_BuiltInAlgorithmOutput
  )

  field(:endTime, as: DateTime)

  field(:finalMetric,
    as:
      GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput_HyperparameterMetric
  )

  field(:hyperparameters, type: :map)
  field(:isTrialStoppedEarly)
  field(:startTime, as: DateTime)
  field(:state)
  field(:trialId)
  field(:webAccessUris, type: :map)
end

defimpl Poison.Decoder,
  for: GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput do
  def decode(value, options) do
    GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput.decode(value, options)
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.MachineLearning.V1.Model.GoogleCloudMlV1_HyperparameterOutput do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
